<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="/templates/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.CreateInvoiceTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <h:panelGroup id="messagePanel" layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
            </h:panelGroup>
            <h:form>
                <h:panelGrid columns="2">
                    <h:outputLabel value="#{bundle.CreateInvoiceLabel_id}" for="id" />
                    <h:inputText id="id" value="#{invoiceController.selected.id}" title="#{bundle.CreateInvoiceTitle_id}" required="true" requiredMessage="#{bundle.CreateInvoiceRequiredMessage_id}"/>
                    <h:outputLabel value="#{bundle.CreateInvoiceLabel_amount}" for="amount" />
                    <h:inputText id="amount" value="#{invoiceController.selected.amount}" title="#{bundle.CreateInvoiceTitle_amount}" required="true" requiredMessage="#{bundle.CreateInvoiceRequiredMessage_amount}"/>
                    <h:outputLabel value="#{bundle.CreateInvoiceLabel_dateOfIssue}" for="dateOfIssue" />
                    <h:inputText id="dateOfIssue" value="#{invoiceController.selected.dateOfIssue}" title="#{bundle.CreateInvoiceTitle_dateOfIssue}" required="true" requiredMessage="#{bundle.CreateInvoiceRequiredMessage_dateOfIssue}">
                        <f:convertDateTime pattern="MM/dd/yyyy" />
                    </h:inputText>
                    <h:outputLabel value="#{bundle.CreateInvoiceLabel_dateOfSale}" for="dateOfSale" />
                    <h:inputText id="dateOfSale" value="#{invoiceController.selected.dateOfSale}" title="#{bundle.CreateInvoiceTitle_dateOfSale}" required="true" requiredMessage="#{bundle.CreateInvoiceRequiredMessage_dateOfSale}">
                        <f:convertDateTime pattern="MM/dd/yyyy" />
                    </h:inputText>
                    <h:outputLabel value="#{bundle.CreateInvoiceLabel_termOfPayment}" for="termOfPayment" />
                    <h:inputText id="termOfPayment" value="#{invoiceController.selected.termOfPayment}" title="#{bundle.CreateInvoiceTitle_termOfPayment}" >
                        <f:convertDateTime pattern="MM/dd/yyyy" />
                    </h:inputText>
                    <h:outputLabel value="#{bundle.CreateInvoiceLabel_wayOfPayment}" for="wayOfPayment" />
                    <h:inputText id="wayOfPayment" value="#{invoiceController.selected.wayOfPayment}" title="#{bundle.CreateInvoiceTitle_wayOfPayment}" />
                    <h:outputLabel value="#{bundle.CreateInvoiceLabel_totalNetPrice}" for="totalNetPrice" />
                    <h:inputText id="totalNetPrice" value="#{invoiceController.selected.totalNetPrice}" title="#{bundle.CreateInvoiceTitle_totalNetPrice}" required="true" requiredMessage="#{bundle.CreateInvoiceRequiredMessage_totalNetPrice}"/>
                    <h:outputLabel value="#{bundle.CreateInvoiceLabel_status}" for="status" />
                    <h:inputText id="status" value="#{invoiceController.selected.status}" title="#{bundle.CreateInvoiceTitle_status}" />
                    <h:outputLabel value="#{bundle.CreateInvoiceLabel_totalGross}" for="totalGross" />
                    <h:inputText id="totalGross" value="#{invoiceController.selected.totalGross}" title="#{bundle.CreateInvoiceTitle_totalGross}" required="true" requiredMessage="#{bundle.CreateInvoiceRequiredMessage_totalGross}"/>
                    <h:outputLabel value="#{bundle.CreateInvoiceLabel_number}" for="number" />
                    <h:inputText id="number" value="#{invoiceController.selected.number}" title="#{bundle.CreateInvoiceTitle_number}" required="true" requiredMessage="#{bundle.CreateInvoiceRequiredMessage_number}"/>
                    <h:outputLabel value="#{bundle.CreateInvoiceLabel_type}" for="type" />
                    <h:inputText id="type" value="#{invoiceController.selected.type}" title="#{bundle.CreateInvoiceTitle_type}" required="true" requiredMessage="#{bundle.CreateInvoiceRequiredMessage_type}"/>
                    <h:outputLabel value="#{bundle.CreateInvoiceLabel_comments}" for="comments" />
                    <h:inputTextarea rows="4" cols="30" id="comments" value="#{invoiceController.selected.comments}" title="#{bundle.CreateInvoiceTitle_comments}" required="true" requiredMessage="#{bundle.CreateInvoiceRequiredMessage_comments}"/>
                    <h:outputLabel value="#{bundle.CreateInvoiceLabel_totalVat}" for="totalVat" />
                    <h:inputText id="totalVat" value="#{invoiceController.selected.totalVat}" title="#{bundle.CreateInvoiceTitle_totalVat}" required="true" requiredMessage="#{bundle.CreateInvoiceRequiredMessage_totalVat}"/>
                    <h:outputLabel value="#{bundle.CreateInvoiceLabel_user}" for="user" />
                    <h:selectOneMenu id="user" value="#{invoiceController.selected.user}" title="#{bundle.CreateInvoiceTitle_user}" required="true" requiredMessage="#{bundle.CreateInvoiceRequiredMessage_user}">
                        <f:selectItems value="#{userController.itemsAvailableSelectOne}"/>
                    </h:selectOneMenu>
                    <h:outputLabel value="#{bundle.CreateInvoiceLabel_customer}" for="customer" />
                    <h:selectOneMenu id="customer" value="#{invoiceController.selected.customer}" title="#{bundle.CreateInvoiceTitle_customer}" required="true" requiredMessage="#{bundle.CreateInvoiceRequiredMessage_customer}">
                        <f:selectItems value="#{customerController.itemsAvailableSelectOne}"/>
                    </h:selectOneMenu>
                </h:panelGrid>
                <br />
                <h:commandLink action="#{invoiceController.create}" value="#{bundle.CreateInvoiceSaveLink}" />
                <br />
                <br />
                <h:commandLink action="#{invoiceController.prepareList}" value="#{bundle.CreateInvoiceShowAllLink}" immediate="true"/>
                <br />
                <br />
                <h:link outcome="/index" value="#{bundle.CreateInvoiceIndexLink}"/>
            </h:form>
        </ui:define>
    </ui:composition>

</html>
